from decorator import decorator

class Namespace:
    def __init__(self,**kwargs):
        self.__dict__.update(kwargs)

import random
def probRandom(probList):
    now=[list(x) for x in probList]

    for i in range(1,len(now)):
        now[i][1]+=now[i-1][1]

    r=random.random()

    for i in range(len(now)):
        if now[i][1]>r:
            return now[i][0]
@decorator
def showTextDecorator(func,self,*args,**kwargs):
    res=func(self,*args,**kwargs)
    self.manager.game.showText(res)
